<?php


namespace app\validate;


use think\Validate;

class Submit extends Validate
{
    protected $rule = [
        'picture_id'=>'require|checkPictureId',
        'submit_name'=>'require|length:2,100',
        'submit_ago'=>'require|number',
        'submit_address'=>'require|min:2',
        'submit_school'=>'require|min:2',
        'submit_grade'=>'require|min:2',
        'submit_phone'=>'require|mobile',
    ];
    protected $field = [
        'picture_id'=>'科目',
        'submit_name'=>'姓名',
        'submit_ago'=>'年龄',
        'submit_address'=>'住址',
        'submit_school'=>'学校',
        'submit_grade'=>'年级',
        'submit_phone'=>'家长电话',
    ];
    protected $scene = [
        'v2' => [
            'submit_name',
            'submit_ago',
            'submit_address',
            'submit_school',
            'submit_grade',
            'submit_phone'],
    ];
    protected function checkPictureId($v){
        if(is_int($v)){
            return true;
        }else{
            return '科目选择有误';
        }
    }
}